//========encoding:utf-8=========
/*
 * @describe:  三目运算符
 * @author:mhao
 * @copyright:chinasoft.cn
 * @date:2020年3月21日   下午7:16:12
 */
package edu.chinasoft.service;

import java.util.List;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import edu.chinasoft.domain.Idcard;
import edu.chinasoft.domain.Item;
import edu.chinasoft.domain.PageUnitForIdcard;
import edu.chinasoft.mapper.IdcardMapper;

@Service("idcardService")
public class IdcardServiceImp implements IdcardService{
	@Autowired
	@Qualifier(value="idcardMapper")
	private IdcardMapper idcardMapper;
    private Logger logger = LoggerFactory.getLogger(IdcardServiceImp.class);
    @Transactional(readOnly=true,propagation=Propagation.SUPPORTS)
	@Override
	public PageUnitForIdcard getRecordNum() {
    	logger.info("IdcardServiceImp>>>getRecordNum start ……");
        PageUnitForIdcard recordNum = idcardMapper.getRecordNum();
        logger.info("IdcardServiceImp>>>getRecordNum end ……");
        return recordNum;
	}
    @Transactional(readOnly=true,propagation=Propagation.SUPPORTS)
	@Override
	public List<Idcard> selectUnitIdcard(Map<String, Object> map) {
		// TODO Auto-generated method stub
    	logger.info("IdcardServiceImp>>>getRecordNum start ……");
        List<Idcard> idcardList = idcardMapper.selectUnitIdcard(map);
        logger.info("IdcardServiceImp>>>getRecordNum end ……");
		return idcardList;
	}
    @Transactional(readOnly = false,propagation = Propagation.REQUIRED)
	@Override
	public boolean deleteIdcardByIdcardId(Idcard idcard) {
		// TODO Auto-generated method stub
    	logger.info("IdcardServiceImp>>>deleteIdcardByIdcardId start ……");
    	boolean userByIdcardId = idcardMapper.deleteUserByIdcardId(idcard);
    	boolean idcardByIdcardId = idcardMapper.deleteIdcardByIdcardId(idcard);
    	logger.info("IdcardServiceImp>>>deleteIdcardByIdcardId end ……");
		return userByIdcardId&&idcardByIdcardId;
	}
	
	

}
